//
//  BaseRequest.h
//  Dermvpure
//
//  Created by <北京>杨硕 on 4/6/16.
//  Copyright © 2016 Dermvpure. All rights reserved.
//

#import "BaseRequest.h"

@implementation BaseRequest

+ (NSString *)urlEncode:(NSString *)string {
  return
      [string stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet
                                                                     URLHostAllowedCharacterSet]];
}

+ (NSString *)stringWithQuery:(NSDictionary *)query {
  NSMutableString *url = [[NSMutableString alloc] init];
  [query enumerateKeysAndObjectsUsingBlock:^(NSString *key, NSString *obj, BOOL *stop) {
    [url appendString:@"&"];
    [url appendString:[BaseRequest urlEncode:key]];
    [url appendString:@"="];
    [url appendString:[BaseRequest urlEncode:obj]];
  }];

  return url;
}


+ (NSString *)urlWithApi:(NSString *)api query:(NSDictionary *)query {
//    if ([[NSUserDefaults standardUserDefaults]boolForKey:ZChangeAppEnvironment]) {
//        政务外网 or 阿里
//        NSMutableString *url = [NSMutableString stringWithFormat:@"%@%@",kUserServiceUrl,api];
//        ZT_AppDelegate.currentIP = kUserServiceUrl;
//        [url appendString:[BaseRequest stringWithQuery:query]];
//        return url;
          //政务外网
//        NSMutableString *url = [NSMutableString stringWithFormat:@"%@%@",ZUserServiceUrl,api];//kUserServiceUrl
//        ZT_AppDelegate.currentIP = kUserServiceUrl;//
//        [url appendString:[BaseRequest stringWithQuery:query]];
//        return url;
//
//    }else{
        //金山
//        NSMutableString *url = [NSMutableString stringWithFormat:@"%@%@",JUserServiceUrl,api];
//        ZT_AppDelegate.currentIP = JUserServiceUrl;
//        [url appendString:[BaseRequest stringWithQuery:query]];
//    DLog(@"请求url = %@",url);
        return @"";

//    }

//  NSMutableString *url = [NSMutableString stringWithFormat:@"%@%@",kUserServiceUrl,api];
//  ZT_AppDelegate.currentIP = kUserServiceUrl;
//  [url appendString:[BaseRequest stringWithQuery:query]];
//  return url;
}

//+ (NSString *)urlWithmanual:(NSString *)url{
//    NSString *userUrl = [NSString stringWithFormat:@"%@%@",kUserServiceUrl1,url];
//    return userUrl;
//}

- (NSString *)url {
//  NOTREACHED();
  return nil;
}


- (NSDictionary *)params {
  return nil;
}


- (ZTHttpMethod)method {
  return ZTHttpMethodGet;
}

@end
